pycharm运行mnist_show.py出现如下问题,

这是深度学习入门这本书里的一段代码,请问这个问题是什么意思以及怎样解决?

报错如下:(下面有源代码)Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] on win32
runfile('E:/PycharmProjects/deep-learning-from-scratch-master/ch03/mnist_show.py', wdir='E:/PycharmProjects/deep-learning-from-scratch-master/ch03')
Converting train-images-idx3-ubyte.gz to NumPy Array ...
Traceback (most recent call last):
File "D:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('E:/PycharmProjects/deep-learning-from-scratch-master/ch03/mnist_show.py', wdir='E:/PycharmProjects/deep-learning-from-scratch-master/ch03')
File "D:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "D:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "E:/PycharmProjects/deep-learning-from-scratch-master/ch03/mnist_show.py", line 13, in
(x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize=False)
File "E:\PycharmProjects\deep-learning-from-scratch-master\dataset\mnist.py", line 106, in load_mnist
init_mnist()
File "E:\PycharmProjects\deep-learning-from-scratch-master\dataset\mnist.py", line 76, in init_mnist
dataset = _convert_numpy()

源代码为:# coding: utf-8

mnist_show.py::::

import sys, os
sys.path.append(os.pardir) # 为了导入父目录的文件而进行的设定
import numpy as np
from dataset.mnist import load_mnist
from PIL import Image

def img_show(img):
pil_img = Image.fromarray(np.uint8(img))
pil_img.show()

(x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize=False)

img = x_train[0]
label = t_train[0]
print(label) # 5

print(img.shape) # (784,)
img = img.reshape(28, 28) # 把图像的形状变为原来的尺寸
print(img.shape) # (28, 28)

img_show(img)

mnist.py:::

coding: utf-8

try:
import urllib.request
except ImportError:
raise ImportError('You should use Python 3.x')
import os.path
import gzip
import pickle
import os
import numpy as np

url_base = 'http://yann.lecun.com/exdb/mnist/'
key_file = {
'train_img':'train-images-idx3-ubyte.gz',
'train_label':'train-labels-idx1-ubyte.gz',
'test_img':'t10k-images-idx3-ubyte.gz',
'test_label':'t10k-labels-idx1-ubyte.gz'
}

dataset_dir = os.path.dirname(os.path.abspath(__file__))
save_file = dataset_dir + "/mnist.pkl"

train_num = 60000
test_num = 10000
img_dim = (1, 28, 28)
img_size = 784

def _download(file_name):
file_path = dataset_dir + "/" + file_name

if os.path.exists(file_path):
    return

print("Downloading " + file_name + " ... ")
urllib.request.urlretrieve(url_base + file_name, file_path)
print("Done")

def download_mnist():
for v in key_file.values():
_download(v)

def _load_label(file_name):
file_path = dataset_dir + "/" + file_name

print("Converting " + file_name + " to NumPy Array ...")
with gzip.open(file_path, 'rb') as f:
        labels = np.frombuffer(f.read(), np.uint8, offset=8)
print("Done")

return labels

def _load_img(file_name):
file_path = dataset_dir + "/" + file_name

print("Converting " + file_name + " to NumPy Array ...")    
with gzip.open(file_path, 'rb') as f:
        data = np.frombuffer(f.read(), np.uint8, offset=16)
data = data.reshape(-1, img_size)
print("Done")

return data

def _convert_numpy():
dataset = {}
dataset['train_img'] = _load_img(key_file['train_img'])
dataset['train_label'] = _load_label(key_file['train_label'])

dataset['test_img'] = _load_img(key_file['test_img'])
dataset['test_label'] = _load_label(key_file['test_label'])

return dataset

def init_mnist():
download_mnist()
dataset = _convert_numpy()
print("Creating pickle file ...")
with open(save_file, 'wb') as f:
pickle.dump(dataset, f, -1)
print("Done!")

def _change_one_hot_label(X):
T = np.zeros((X.size, 10))
for idx, row in enumerate(T):
row[X[idx]] = 1

return T

def load_mnist(normalize=True, flatten=True, one_hot_label=False):
"""读入MNIST数据集

Parameters
----------
normalize : 将图像的像素值正规化为0.0~1.0
one_hot_label : 
    one_hot_label为True的情况下,标签作为one-hot数组返回
    one-hot数组是指[0,0,1,0,0,0,0,0,0,0]这样的数组
flatten : 是否将图像展开为一维数组

Returns
-------
(训练图像, 训练标签), (测试图像, 测试标签)
"""
if not os.path.exists(save_file):
    init_mnist()

with open(save_file, 'rb') as f:
    dataset = pickle.load(f)

if normalize:
    for key in ('train_img', 'test_img'):
        dataset[key] = dataset[key].astype(np.float32)
        dataset[key] /= 255.0

if one_hot_label:
    dataset['train_label'] = _change_one_hot_label(dataset['train_label'])
    dataset['test_label'] = _change_one_hot_label(dataset['test_label'])

if not flatten:
     for key in ('train_img', 'test_img'):
        dataset[key] = dataset[key].reshape(-1, 1, 28, 28)

return (dataset['train_img'], dataset['train_label']), (dataset['test_img'], dataset['test_label']) 

if name == '__main__':
init_mnist()

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
pycharm断点运行后会出现_pydev_execfile.py文件

我在断点运行文件时 文件代码可以正常跑完没有bug 但是每次都会弹出_pydev_execfile.py文件 文件代码图如下![图片说明](https://img-ask.csdn.net/upload/202004/02/1585840678_347553.png) 希望有老师可以解决一下pydev_execfile.py 文件总是弹出的问题谢谢 有劳

pyinstaller打包错误 No module name pyg_resources.py2_warn

我用kivy(一个gui开发模块)制作了一个简单的gui程序,idle运行正常,代码如下: ``` import os import kivy from kivy.app import App from kivy.uix.label import Label from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput import TextInput from kivy.uix.button import Button from kivy.uix.screenmanager import ScreenManager,Screen class ConnectPage(GridLayout): def __init__(self,**kwargs): super().__init__(**kwargs) self.cols = 2 if os.path.isfile("C:/Users/Administrator/Desktop/informations.txt"): with open("C:/Users/Administrator/Desktop/informations.txt","r") as f: d = f.read().split(",") prev_ip = d[0] prev_port = d[1] prev_username = d[2] else: prev_ip = "" prev_port = "" prev_username = "" self.add_widget(Label(text="IP:")) self.ip = TextInput(text=prev_ip,multiline=False) self.add_widget(self.ip) self.add_widget(Label(text="Port:")) self.port = TextInput(text=prev_port,multiline=False) self.add_widget(self.port) self.add_widget(Label(text="Username:")) self.username = TextInput(text=prev_username,multiline=False) self.add_widget(self.username) self.join = Button(text="Join") self.join.bind(on_press=self.join_button) self.add_widget(Label()) self.add_widget(self.join) def join_button(self,type): port = self.port.text ip = self.ip.text username = self.username.text with open("C:/Users/Administrator/Desktop/informations.txt","w") as f: f.write(f"{ip},{port},{username}") info = f"Attempting to join {ip}:{port} as {username}" chat_app.info_page.update_info(info) chat_app.screen_manager.current = "Info" class InfoPage(GridLayout): def __init__(self,**kwargs): super().__init__(**kwargs) self.cols = 1 self.message = Label(halign="center",valign="middle",font_size=30) self.message.bind(width=self.update_text_width) self.add_widget(self.message) def update_info(self,message): self.message.text = message def update_text_width(self,*_): self.message.text_size = (self.message.width*0.9,None) class EpicApp(App): def build(self): self.screen_manager = ScreenManager() self.connect_page = ConnectPage() screen = Screen(name="Connect") screen.add_widget(self.connect_page) self.screen_manager.add_widget(screen) self.info_page = InfoPage() screen = Screen(name="Info") screen.add_widget(self.info_page) self.screen_manager.add_widget(screen) return self.screen_manager if __name__ == "__main__": chat_app = EpicApp() chat_app.run() ``` 当我在命令行输入pyinstaller -F main.py(上面代码文件),打包没有异常。 之后我尝试打开exe,报错了: ![pyinstaller打包错误](https://cdn.learnku.com/uploads/images/202003/09/46422/8nrk2iOQY5.png!large) (这是我在闪退的瞬间拍到的) 经过一段时间,我按照kivy打包指南,先弄spec文件,修改,然后编译。结果是一样的错误。 我又试着后面加上--hidden-import pyg_resources.py2_warn。 但还是报了同样的错误。 后来,我用了setuptools降级的方法,出现了这个错误 ![图片说明](https://img-ask.csdn.net/upload/202003/10/1583809013_424164.png) 注意,这个main.py的名字我改成了chat_app.py,大家不要留意。 我又试着把pkg_resources的__init__.py的86行删了,报错和上面一样。 有哪位大佬知道如何解决?

windows10系统使用pycharm创建项目时报错,有大佬解释一下吗?报错如下

raceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\packaging_tool.py", line 170, in main do_pyvenv(path, system_site_packages) File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\packaging_tool.py", line 88, in do_pyvenv venv.create(path, system_site_packages=system_site_packages) File "D:\Python\Anaconda3\lib\venv\__init__.py", line 363, in create builder.create(env_dir) File "D:\Python\Anaconda3\lib\venv\__init__.py", line 66, in create self.setup_python(context) File "D:\Python\Anaconda3\lib\venv\__init__.py", line 204, in setup_python copier(context.executable, path) File "D:\Python\Anaconda3\lib\venv\__init__.py", line 192, in symlink_or_copy shutil.copyfile(src, dst) File "D:\Python\Anaconda3\lib\shutil.py", line 120, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: 'D:\\Python\\Anaconda3\\lib\\venv\\scripts\\nt\\python.exe'

pycharm引用cx_oracle报错

#### import cx_Oracle直接报错 ``` Traceback (most recent call last): File "D:/Documents/Py_file/py_excel/open_oracle.py", line 3, in <module> import cx_Oracle File "D:\Program Files (x86)\Python36-32\lib\site-packages\cx_Oracle\__init__.py", line 10, in <module> from custom_exceptions import Warning, Error, InterfaceError, DatabaseError, DataError, OperationalError, IntegrityError, InternalError, ProgrammingError, NotSupportedError ModuleNotFoundError: No module named 'custom_exceptions' ``` 代码之前运行是没问题的,后面因为使用了一下sqlite3模块,为了消除if not exists下面的小红线,就Alt+Enter,把数据库变成了sqlite,再之后import cx_Oracle就报错了。

panda包导入出错 python

报错信息: ``` Traceback (most recent call last): File "<input>", line 1, in <module> File "D:\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "D:\PyCharm 2018.2.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:/PycharmProject/KNN.py", line 3, in <module> import panda as pd File "D:\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import module = self._system_import(name, *args, **kwargs) File "D:\PycharmProject\venv\lib\site-packages\panda\__init__.py", line 1, in <module> from request import PandaRequest ImportError: cannot import name 'PandaRequest' from 'request' (D:\PycharmProject\venv\lib\site-packages\request\__init__.py) ``` 该怎么解决 急 在线等

ValueError: No data files found in satellite/data\satellite_train_*.tfrecord

跟着书做"打造自己的图片识别模型"项目时候遇到报错,报错早不到数据文件,但是文件路径和数据都没问题 D:\Anaconda\anaconda\envs\tensorflow\python.exe D:/PyCharm/PycharmProjects/chapter_3/slim/train_image_classifier.py --train_dir=satellite/train_dir --dataset_name=satellite --dataset_split_name=train --dataset_dir=satellite/data --model_name=inception_v3 --checkpoint_path=satellite/pretrained/inception_v3.ckpt --checkpoint_exclude_scopes=InceptionV3/Logits,InceptionV3/AuxLogits --trainable_scopes=InceptionV3/Logits,InceptionV3/AuxLogits --max_number_of_steps=100000 --batch_size=32 --learning_rate=0.001 --learning_rate_decay_type=fixed --save_interval_secs=300 --save_summaries_secs=2 --log_every_n_steps=10 --optimizer=rmsprop --weight_decay=0.00004 WARNING:tensorflow:From D:/PyCharm/PycharmProjects/chapter_3/slim/train_image_classifier.py:397: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version. Instructions for updating: Please switch to tf.train.create_global_step Traceback (most recent call last): File "D:/PyCharm/PycharmProjects/chapter_3/slim/train_image_classifier.py", line 572, in <module> tf.app.run() File "D:\Anaconda\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "D:/PyCharm/PycharmProjects/chapter_3/slim/train_image_classifier.py", line 430, in main common_queue_min=10 * FLAGS.batch_size) File "D:\Anaconda\anaconda\envs\tensorflow\lib\site-packages\tensorflow\contrib\slim\python\slim\data\dataset_data_provider.py", line 94, in __init__ scope=scope) File "D:\Anaconda\anaconda\envs\tensorflow\lib\site-packages\tensorflow\contrib\slim\python\slim\data\parallel_reader.py", line 238, in parallel_read data_files = get_data_files(data_sources) File "D:\Anaconda\anaconda\envs\tensorflow\lib\site-packages\tensorflow\contrib\slim\python\slim\data\parallel_reader.py", line 311, in get_data_files raise ValueError('No data files found in %s' % (data_sources,)) ValueError: No data files found in satellite/data\satellite_train_*.tfrecord

使用pyCharm调试出错,python版本为2.3.5,求大神帮忙

E:\Python23\python.exe "E:\PyCharm 3.4.1\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 18039 --file D:/project/python/vignette/arrayImage.py Traceback (most recent call last): File "E:\PyCharm 3.4.1\helpers\pydev\pydevd.py", line 4, in ? from django_debug import DjangoLineBreakpoint File "E:\PyCharm 3.4.1\helpers\pydev\django_debug.py", line 3, in ? from pydevd_comm import CMD_SET_BREAK File "E:\PyCharm 3.4.1\helpers\pydev\pydevd_comm.py", line 89, in ? from socket import SHUT_RD, SHUT_WR ImportError: cannot import name SHUT_RD

pycharm无法导入包的问题

有大神吗。。。anaconda运行就可以,numpy和matplotlib库都行。但是一用pycharm,就不行了。说找不到模块。pycharm里面的环境是echo%path%来的,我全复制粘贴上去了,而且包下载的环境和运行的环境都是base。搞了一天了,人快没了。 ![图片说明](https://img-ask.csdn.net/upload/202003/14/1584182209_946789.png)![图片说明](https://img-ask.csdn.net/upload/202003/14/1584182220_113000.png)![图片说明](https://img-ask.csdn.net/upload/202003/14/1584182225_375399.png)![图片说明](https://img-ask.csdn.net/upload/202003/14/1584182231_653730.png)![图片说明](https://img-ask.csdn.net/upload/202003/14/1584182236_990596.png)

Anaconda3+python3.7 +TensorFlow 2.1,安装成功,但是在IDLE和pycharm中引入出现如下错误,请问如何才能解决?

Traceback (most recent call last): File "F:\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "F:\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "F:\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "F:\Anaconda\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "F:\Anaconda\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import tensorflow File "F:\Anaconda\lib\site-packages\tensorflow\__init__.py", line 101, in <module> from tensorflow_core import * File "F:\Anaconda\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module> from tensorflow.python.tools import module_util as _module_util File "F:\Anaconda\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__ module = self._load() File "F:\Anaconda\lib\site-packages\tensorflow\__init__.py", line 44, in _load module = _importlib.import_module(self.__name__) File "F:\Anaconda\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "F:\Anaconda\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "F:\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "F:\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "F:\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "F:\Anaconda\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "F:\Anaconda\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "F:\Anaconda\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.

Pycharm中可以运行,cmd运行时报错Failed to load the native TensorFlow runtime

在pycharm中设置了Python解释器,可以正常运行Python代码。 在cmd中使用相同的解释器去运行代码报错,下面是错误信息。 ``` Traceback (most recent call last): File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\Users\xmei\.conda\envs\text_categorization\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\xmei\.conda\envs\text_categorization\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "G:\Text_categorization\project\system.py", line 11, in <module> from tcnn_model import * File "G:\Text_categorization\project\tcnn_model.py", line 5, in <module> import tensorflow as tf File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\xmei\.conda\envs\text_categorization\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\Users\xmei\.conda\envs\text_categorization\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\xmei\.conda\envs\text_categorization\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. ```

关于pycharm 调试python时抛出非自身程序异常

直接运行2个print语句,顺利打印,但是一断点就报错" D:\Code Path\Python\python.exe" "D:\Code Path\PyCharm Community Edition 2017.2\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 51337 --file D:/Pyworkpace/test.py pydev debugger: process 5864 is connecting Connected to pydev debugger (build 172.3544.44) Traceback (most recent call last): File "D:\Code Path\PyCharm Community Edition 2017.2\helpers\pydev\pydevd.py", line 1599, in <module> globals = debugger.run(setup['file'], None, None, is_module) File "D:\Code Path\PyCharm Community Edition 2017.2\helpers\pydev\pydevd.py", line 1002, in run self.prepare_to_run() File "D:\Code Path\PyCharm Community Edition 2017.2\helpers\pydev\pydevd.py", line 905, in prepare_to_run self.patch_threads() File "D:\Code Path\PyCharm Community Edition 2017.2\helpers\pydev\pydevd.py", line 926, in patch_threads patch_thread_modules() File "D:\Code Path\PyCharm Community Edition 2017.2\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 656, in patch_thread_modules patch_thread_module(t) File "D:\Code Path\PyCharm Community Edition 2017.2\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 622, in patch_thread_module _original_start_new_thread = thread._original_start_new_thread = thread.start_new_thread AttributeError: module 'thread' has no attribute 'start_new_thread' 重新下了几次pycharm也不行,用的是Anaconda的python3.6

用pyinstaller打包py程序后运行闪退,pycharm和Jupiter环境中运行均无问题,cmd检查出现以下错误,劳知晓具体解决问题办法大佬解答

D:\tool\Anaconda\Scripts\dist>.\"index smooth.exe" Traceback (most recent call last): File "site-packages\PyInstaller\loader\rthooks\pyi_rth_certifi.py", line 13, in <module> File "d:\tool\anaconda\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.__dict__) File "ssl.py", line 98, in <module> ImportError: DLL load failed: 找不到指定的模块。 [19648] Failed to execute script pyi_rth_certifi

安装pyCharm后pip不能用,显示No module named 'pip._vendor.urllib3如何解决?

安装python后pip是可以用的,但是安装pyCharm后任何带有pip的语句都不能执行 在cmd中输入pip,显示以下信息: ![图片说明](https://img-ask.csdn.net/upload/201903/02/1551514735_187825.jpg) 输入python -m pip uninstall pip,显示: ![图片说明](https://img-ask.csdn.net/upload/201903/02/1551514947_711238.jpg) 怎么解决呢?

pycharm中无法导入numpy,求解原因?

安装完numpy在pycharm 中 import numpy,运行出来的结果却是这样子,求大神指教解决办法,谢谢! Traceback (most recent call last): File "C:/Users/上官鸡/Desktop/爱编程的里头奇奇/easygui试用.py", line 1, in <module> import numpy File "C:\Program Files\Python37\Lib\site-packages\numpy\__init__.py", line 142, in <module> from . import core File "C:\Program Files\Python37\Lib\site-packages\numpy\core\__init__.py", line 23, in <module> WinDLL(os.path.abspath(filename)) File "E:\lib\ctypes\__init__.py", line 364, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 不是有效的 Win32 应用程序。

pyinstaller打包.py文件出错,求解

pyinstaller打包.py文件出错,求解 ``` Traceback (most recent call last): File "c:\users\86134\appdata\local\programs\python\python38-32\lib\runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\86134\appdata\local\programs\python\python38-32\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\86134\AppData\Local\Programs\Python\Python38-32\Scripts\pyinstaller.exe\__main__.py", line 7, in <module> File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\__main__.py", line 111, in run run_build(pyi_config, spec_file, **vars(args)) File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build exec(code, spec_namespace) File "C:\Users\86134\Desktop\qw.spec", line 18, in <module> pyz = PYZ(a.pure, a.zipped_data, File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 98, in __init__ self.__postinit__() File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__ self.assemble() File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 128, in assemble self.code_dict = { File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 129, in <dictcomp> key: strip_paths_in_code(code) File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code consts = tuple( File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\utils.py", line 653, in <genexpr> strip_paths_in_code(const_co, new_filename) File "c:\users\86134\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\utils.py", line 660, in strip_paths_in_code return code_func(co.co_argcount, co.co_kwonlyargcount, co.co_nlocals, co.co_stacksize, TypeError: an integer is required (got type bytes) ```

python 2.7.5 random.randint(0,1) 错误

Traceback (most recent call last): File "E:/code/python/pycharm/wangyi_5.py", line 43, in <module> simFlips(100,100) File "E:/code/python/pycharm/wangyi_5.py", line 20, in simFlips heads,tails=flipTrial(numFlips) File "E:/code/python/pycharm/wangyi_5.py", line 12, in flipTrial coin=random.randint(0,1) AttributeError: 'builtin_function_or_method' object has no attribute 'randint' import random import math from pylab import * def flipTrial(numFlips): heads,tails=0,0 for i in xrange(0,numFlips):#xrange进行示例时不用建表,依次执行结果,比rang节省空间 coin=random.randint(0,1) if coin==0:heads +=1 else:tails+=1 return heads,tails

anaconda 安装pytorch成功,PyCharm使用anaconda环境时在import torch这个地方报错

**我用anaconda成功安装pytorch,,测试结果如下:** ![图片说明](https://img-ask.csdn.net/upload/201907/31/1564571781_433161.jpg) **然后我配置PyCharm使用anaconda已经成功安装pytorh了的环境,如下图:** ![图片说明](https://img-ask.csdn.net/upload/201907/31/1564572015_840592.jpg) **都没问题,但是我测试的时候却出错了:** ![图片说明](https://img-ask.csdn.net/upload/201907/31/1564572102_460453.jpg) ![图片说明](https://img-ask.csdn.net/upload/201907/31/1564572161_739375.jpg) **我试过添加环境变量,把...torch/lib(_C.lib就在这里面)添加到PATH不行,sys,path.apend()也不行,仍然报同样的错。。。** 请问怎么解决?

pycharm使用时,出现模块调用失败,怎么解决?

Traceback (most recent call last): File "C:/Temp/lassos/first.py", line 4, in <module> from sklearn.preprocessing import Imputer File "C:\Users\Dell\Anaconda3\lib\site-packages\sklearn\__init__.py", line 134, in <module> from .base import clone File "C:\Users\Dell\Anaconda3\lib\site-packages\sklearn\base.py", line 13, in <module> from .utils.fixes import signature File "C:\Users\Dell\Anaconda3\lib\site-packages\sklearn\utils\__init__.py", line 10, in <module> from .validation import (as_float_array, File "C:\Users\Dell\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 18, in <module> from ..utils.fixes import signature File "C:\Users\Dell\Anaconda3\lib\site-packages\sklearn\utils\fixes.py", line 144, in <module> from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa File "C:\Users\Dell\Anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.py", line 114, in <module> from .isolve import * File "C:\Users\Dell\Anaconda3\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 8, in <module> from .lgmres import lgmres File "C:\Users\Dell\Anaconda3\lib\site-packages\scipy\sparse\linalg\isolve\lgmres.py", line 10, in <module> from scipy.linalg import get_blas_funcs, get_lapack_funcs File "C:\Users\Dell\Anaconda3\lib\site-packages\scipy\linalg\__init__.py", line 190, in <module> from .misc import * File "C:\Users\Dell\Anaconda3\lib\site-packages\scipy\linalg\misc.py", line 5, in <module> from .blas import get_blas_funcs File "C:\Users\Dell\Anaconda3\lib\site-packages\scipy\linalg\blas.py", line 214, in <module> from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.

pycharm里运行.sh文件与在shell里运行,有什么不同

同一个hello.sh文件,在shell里运行没问题,但在pycharm里却报错。 ![图片说明](https://img-ask.csdn.net/upload/201806/04/1528097918_459248.jpg) ![图片说明](https://img-ask.csdn.net/upload/201806/04/1528097937_675579.jpg) ![图片说明](https://img-ask.csdn.net/upload/201806/04/1528097950_236159.jpg)

学Python后到底能干什么?网友:我太难了

感觉全世界营销文都在推Python,但是找不到工作的话,又有哪个机构会站出来给我推荐工作? 笔者冷静分析多方数据,想跟大家说:关于超越老牌霸主Java,过去几年间Python一直都被寄予厚望。但是事实是虽然上升趋势,但是国内环境下,一时间是无法马上就超越Java的,也可以换句话说:超越Java只是时间问题罢。 太嚣张了会Python的人!找工作拿高薪这么简单? https://edu....

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

为什么程序猿都不愿意去外包?

分享外包的组织架构,盈利模式,亲身经历,以及根据一些外包朋友的反馈,写了这篇文章 ,希望对正在找工作的老铁有所帮助

Java校招入职华为,半年后我跑路了

何来 我,一个双非本科弟弟,有幸在 19 届的秋招中得到前东家华为(以下简称 hw)的赏识,当时秋招签订就业协议,说是入了某 java bg,之后一系列组织架构调整原因等等让人无法理解的神操作,最终毕业前夕,被通知调往其他 bg 做嵌入式开发(纯 C 语言)。 由于已至于校招末尾,之前拿到的其他 offer 又无法再收回,一时感到无力回天,只得默默接受。 毕业后,直接入职开始了嵌入式苦旅,由于从未...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

@程序员:GitHub这个项目快薅羊毛

今天下午在朋友圈看到很多人都在发github的羊毛,一时没明白是怎么回事。 后来上百度搜索了一下,原来真有这回事,毕竟资源主义的羊毛不少啊,1000刀刷爆了朋友圈!不知道你们的朋友圈有没有看到类似的消息。 这到底是啥情况? 微软开发者平台GitHub 的一个区块链项目 Handshake ,搞了一个招募新会员的活动,面向GitHub 上前 25万名开发者派送 4,246.99 HNS币,大约价...

用python打开电脑摄像头,并把图像传回qq邮箱【Pyinstaller打包】

前言: 如何悄悄的打开朋友的摄像头,看看她最近过的怎么样,嘿嘿!这次让我带你们来实现这个功能。 注: 这个程序仅限在朋友之间开玩笑,别去搞什么违法的事情哦。 代码 发送邮件 使用python内置的email模块即可完成。导入相应的代码封装为一个send函数,顺便导入需要导入的包 注: 下面的代码有三处要修改的地方,两处写的qq邮箱地址,还有一处写的qq邮箱授权码,不知道qq邮箱授权码的可以去百度一...

做了5年运维,靠着这份监控知识体系,我从3K变成了40K

从来没讲过运维,因为我觉得运维这种东西不需要太多的知识面,然后我一个做了运维朋友告诉我大错特错,他就是从3K的运维一步步到40K的,甚至笑着说:我现在感觉自己什么都能做。 既然讲,就讲最重要的吧。 监控是整个运维乃至整个产品生命周期中最重要的一环,事前及时预警发现故障,事后提供详实的数据用于追查定位问题。目前业界有很多不错的开源产品可供选择。选择一款开源的监控系统,是一个省时省力、效率最高的方...

C++(继承):19---虚基类与虚继承(virtual)

一、菱形继承 在介绍虚继承之前介绍一下菱形继承 概念:A作为基类,B和C都继承与A。最后一个类D又继承于B和C,这样形式的继承称为菱形继承 菱形继承的缺点: 数据冗余:在D中会保存两份A的内容 访问不明确(二义性):因为D不知道是以B为中介去访问A还是以C为中介去访问A,因此在访问某些成员的时候会发生二义性 缺点的解决: 数据冗余:通过下面“虚继承”技术来解决(见下) 访问...

再不跳槽,应届毕业生拿的都比我多了!

跳槽几乎是每个人职业生涯的一部分,很多HR说“三年两跳”已经是一个跳槽频繁与否的阈值了,可为什么市面上有很多程序员不到一年就跳槽呢?他们不担心影响履历吗? PayScale之前发布的**《员工最短任期公司排行榜》中,两家码农大厂Amazon和Google**,以1年和1.1年的员工任期中位数分列第二、第四名。 PayScale:员工最短任期公司排行榜 意外的是,任期中位数极小的这两家公司,薪资...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

华为初面+综合面试(Java技术面)附上面试题

华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

win10暴力查看wifi密码

刚才邻居打了个电话说:喂小灰,你家wifi的密码是多少,我怎么连不上了。 我。。。 我也忘了哎,就找到了一个好办法,分享给大家: 第一种情况:已经连接上的wifi,怎么知道密码? 打开:控制面板\网络和 Internet\网络连接 然后右击wifi连接的无线网卡,选择状态 然后像下图一样: 第二种情况:前提是我不知道啊,但是我以前知道密码。 此时可以利用dos命令了 1、利用netsh wlan...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

女朋友过生日,我花了20分钟给她写了一个代理服务器

女朋友说:“看你最近挺辛苦的,我送你一个礼物吧。你看看想要什么,我来准备。” 我想了半天,从书到鞋子到电子产品最后到生活用品,感觉自己什么都不缺,然后和她说:“你省省钱吧,我什么都不需要。” 她坚持要送:“不行,你一定要说一个礼物,我想送你东西了。” 于是,我认真了起来,拿起手机,上淘宝逛了几分钟,但还是没能想出来缺点什么,最后实在没办法了:“这样吧,如果你实在想送东西,那你就写一个代理服务器吧”...

记一次腾讯面试,我挂在了最熟悉不过的队列上……

腾讯后台面试,面试官问:如何自己实现队列?

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

!大部分程序员只会写3年代码

如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

立即提问
相关内容推荐