尝试在我的项目中运行virtualenv,但显示一些错误。不幸的是,找不到正确的解决方案。也许以前有人处理过相同的问题。
(base) Organic:djangoproject organic$ mkvirtualenv py1
Using base prefix '/anaconda3'
New python executable in /Users/organic/.virtualenvs/py1/bin/python3
Traceback (most recent call last):
File "/anaconda3/bin/virtualenv", line 11, in <module>
load_entry_point('virtualenv==16.1.0.dev0', 'console_scripts', 'virtualenv')()
File "/anaconda3/lib/python3.6/site-packages/virtualenv.py", line 712, in main
symlink=options.symlink)
File "/anaconda3/lib/python3.6/site-packages/virtualenv.py", line 928, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/anaconda3/lib/python3.6/site-packages/virtualenv.py", line 1234, in install_python
shutil.copyfile(executable, py_executable)
File "/anaconda3/lib/python3.6/shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
OSError: [Errno 62] Too many levels of symbolic links: '/Users/organic/.virtualenvs/py1/bin/python3'
答案 0 :(得分:0)
谢谢你们,我已经解决了这个问题,方法是弄清楚如何在VS Code的整个Anaconda中切换到适当的virtualenv。因此,现在,我仅使用默认情况下已设置为conda的(基本)virtualenv。到目前为止,我所有的最后一个项目似乎都没有任何副作用。
在Mac OS上不了解VS Code的用户,请使用shift + command + p-> Python:选择Interpreter,然后选择Anaconda解释器Python 3.6.6 64位(“ base”:conda)anaconda3 / bin /蟒蛇。请注意,您的virtualenv可以具有不同的名称,而不是'base'。
然后,再次单击shift + command + p选择Python:“创建终端”,VSC将运行一个终端,在该终端下,您的virtualenv将被打开,就像我的情况@SuppressWarnings("serial")
class BackgroundPanel2 extends JPanel {
private Image backgroundImg;
public BackgroundPanel2(Image backgroundImg) {
this.backgroundImg = backgroundImg;
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (backgroundImg != null) {
g.drawImage(backgroundImg, 0, 0, this);
}
}
@Override
public Dimension getPreferredSize() {
if (isPreferredSizeSet() || backgroundImg == null) {
return super.getPreferredSize();
} else {
int w = backgroundImg.getWidth(this);
int h = backgroundImg.getHeight(this);
return new Dimension(w, h);
}
}
}
@SuppressWarnings("serial")
class GamePanel2 extends JPanel {
public static final int MAX_BUTTONS = 100;
private static final int IMG_WIDTH = 40;
JButton[] gameButtons = new JButton[MAX_BUTTONS];
public GamePanel2(Image buttonImg) {
setOpaque(false);
if (buttonImg.getWidth(this) > IMG_WIDTH) {
buttonImg = buttonImg.getScaledInstance(IMG_WIDTH, IMG_WIDTH, Image.SCALE_SMOOTH);
}
Icon icon = new ImageIcon(buttonImg);
setLayout(new GridLayout(10, 10, 4, 4));
for (int i = 0; i < gameButtons.length; i++) {
int finalIndex = i;
JButton btn = new JButton(icon);
btn.addActionListener(e -> {
String text = String.format("Button: %02d", finalIndex);
System.out.println(text);
});
add(btn);
gameButtons[i] = btn;
}
}
}
一样。